# $Id: PKGBUILD 81399 2012-12-19 13:39:36Z seblu $
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Contributor: SpepS <dreamspepser at yahoo dot it>
# Contributor: Laszlo Papp <djszapi at archlinux us>
# Contributor: Donald Ephraim Curtis <dcurtis@gmail.com>

pkgbase=luaposix
pkgname=('lua-posix' 'lua51-posix')
pkgver=5.1.23
pkgrel=2
pkgdesc='A POSIX library for Lua programming language'
arch=('i686' 'x86_64')
url='http://luaforge.net/projects/luaposix/'
license=('GPL' 'LGPL')
makedepends=('lua' 'lua51' 'lua51-bitop')
options=('!libtool')
source=("https://github.com/downloads/$pkgbase/$pkgbase/$pkgbase-$pkgver.tar.gz")
md5sums=('ebe7d335741ca736e003a6844a0fbf92')

build() {
  cd $pkgbase-$pkgver
  mkdir build_51 build_52
  msg2 'Build with lua 5.2'
  cd build_52
  ../configure \
      --prefix=/usr \
      --libdir=/usr/lib/lua/5.2 \
      --datadir=/usr/share/lua/5.2 \
      --docdir=/usr/share/doc/lua-posix
  make
  msg2 'Build with lua 5.1'
  cd ../build_51
  ../configure CFLAGS=-I/usr/include/lua5.1 \
      --prefix=/usr \
      --libdir=/usr/lib/lua/5.1 \
      --datadir=/usr/share/lua/5.1 \
      --docdir=/usr/share/doc/lua51-posix
  make
}

package_lua-posix() {
  depends=('lua')

  cd $pkgbase-$pkgver/build_52
  make DESTDIR="$pkgdir/" install
}

package_lua51-posix() {
  depends=('lua51' 'lua51-bitop')
  conflicts=('luaposix')
  replaces=('luaposix')

  cd $pkgbase-$pkgver/build_51
  make DESTDIR="$pkgdir/" install
}

# vim:set ts=2 sw=2 et:
